fix: add deepseek-v4 models, fix calculate_cost, and improve error ha…#2736
fix: add deepseek-v4 models, fix calculate_cost, and improve error ha…#2736Comui520 wants to merge 1 commit into
Conversation
|
@Comui520 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
38b6cae to
4d4664e
Compare
|
hey @Comui520 thanks for this. I believe the fix should be at the |
- Register deepseek-v4-flash and deepseek-v4-pro in DEEPSEEK_MODELS_DATA - Guard evaluate_chunk and a_evaluate_chunk against None cost from calculate_cost() when model pricing is unknown - Guard _generate_schema, _a_generate_schema, _generate, _a_generate against None cost in the same way - Raise DeepEvalError when all document pipelines fail instead of silently returning empty contexts - Raise DeepEvalError when generated contexts list is empty deepseek-chat and deepseek-reasoner will be deprecated on 2026-07-24 in favor of v4-flash and v4-pro.
4d4664e to
a7708cb
Compare
|
Done — moved the fix to the boundaries, left Files changed (3)
What the fix doesAt every call site where # Before (crashes when pricing is unknown)
self.total_cost += cost
# After
if cost is not None:
self.total_cost += costThis prevents the The context generator and synthesizer now also raise explicit Why this approach
|
|
@penguine-ip , appreciate your feedback. The None handling is now placed at the evaluate_chunk boundary, with other provider code untouched. Error visibility and new DeepSeek model support are also included. |
Summary
deepseek-v4-flashanddeepseek-v4-proinDEEPSEEK_MODELS_DATAcalculate_cost()across all 8 providers to never returnNoneContextGeneratorandSynthesizerto surface errors instead of silently returning empty resultsDetails
Problem
When pricing data is unknown (model not in registry),
calculate_cost()returnedNoneacross ALL providers (DeepSeek, Anthropic, OpenAI, Azure, Gemini, Kimi, Grok, Bedrock),
causing
TypeErrorinContextGenerator.evaluate_chunk()(total_cost += None).This error was caught by a broad
except Exceptionand logged but never surfaced,resulting in empty goldens with no error to the user.
Changes
All 8 provider models —
calculate_cost()now returnsEvaluationCost(0.0, ...)when prices are unknown, instead of
None. Fixes theOptional[float]return typeto be consistently
float.constants.py— Added model definitions fordeepseek-v4-flashanddeepseek-v4-pro.context_generator.py—generate_contexts()anda_generate_contexts()now raiseDeepEvalErrorwhen ALL documents fail, instead of silently returning empty contexts.synthesizer.py—generate_goldens_from_docs()anda_generate_goldens_from_docs()now raise
DeepEvalErrorwhen contexts are empty.Why this matters now
Per DeepSeek API docs,
deepseek-chatanddeepseek-reasonerwill be deprecated on 2026-07-24 in favor ofdeepseek-v4-flashand
deepseek-v4-pro.